﻿$(document).ready(function(){
       $('.liuyan_btn').click(function () {
        $(this).html("正在留言……");
        $(this).attr("disabled", "disabled");       
        var name = $('.msg_name').val();
        var mobile = $('.msg_mobile').val();
        var detail = $('.msg_detail').val();
        var type = $('.type').val();
        var id = $('.thisid').val();
        var title = $('.thistitle').val();
        var weid = $('.weid').val();
        var result = true;
        
        if (mobile.length != 11 || name == "") {
            alert("请留下您的姓名和手机以方便我联系您！");
            $(this).html("确认提交");
            $(this).removeAttr("disabled");
            return;
        }
                
        $.ajax({
            url: "liuyan.ashx",
            type: "POST",
            data: { name: name, mobile: mobile, detail: detail, title: title, type: type, id: id, weid: weid },
            dataType: "text",
            success: function (data) {
                alert("留言成功，感谢您的关注！");
                $('.msg_name').val("")
                $('.msg_mobile').val("")
                $('.msg_detail').val("")

            },
            error: function (data) {
                //alert(data.responseText);                       
            }
        });
        $(this).html("确认提交");
        $(this).removeAttr("disabled");

    });

})